using System.IO;
using System.Text;
using System.Windows.Media.Imaging;

namespace MMXSaveGameConverter
{
    internal sealed class LgsFileWriter : FileWriterBase
    {
        private readonly string _lgsPath;
        private readonly string _pngPath;

        public LgsFileWriter(SaveGameViewItem item)
            : base(item)
        {
            _lgsPath = Path.ChangeExtension(item.FullPath, ".lgs");
            _pngPath = Path.ChangeExtension(item.FullPath, ".png");
        }

        public override void Write()
        {
            using (Stream output = File.Create(_lgsPath))
                WriteSaveGame(output, Item.Name);
            using (Stream output = File.Create(_pngPath))
                WriteScreenshot(output);
        }
    }
}